#ifndef SERVERSETTING_H
#define SERVERSETTING_H

#include <QSettings>
#include <QMap>
#include <QStringList>
#include <QTimer>
#include "module/cwatchdogttyama2.h"

const int g_version = 14;

class ServerSetting : public QSettings
{
    Q_OBJECT
public:
    static ServerSetting *defaultSetting();
    static void clearDefaultSetting();
    bool keyVerifyOK;
    QString getSerial();
    bool keyAndVerify(QByteArray key);
    QByteArray descrySerial();

    void readConfig();
    void writeConfig();
    QString getAesKey();
    QString getHostIpString(QString ethName);
    QByteArray readMacData();

    void srcAddress2int(QString src);

    QString _cloundServerIp,_serial,
    _user,_password,_ip,_port,_aeskey,_project_url,_update_url,_network
    ,_rstate_url,_record_url,_reload_knx,_ip_update,_push_ip,_push_serial;

    int _record;
    int _system_ver;
    //gateway src address
    unsigned int _src_addr;

public slots:
    void doDog();
    bool doStopDog();

private:
    explicit ServerSetting(QObject *parent = 0);

    QString path;
    QTimer _dogTimer;
    CWatchDogTtyAMA2 _dog;
};

#endif // SERVERSETTING_H
